/*    */ package org.yaukie.auth.config;
/*    */ 
/*    */ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
/*    */ import java.util.Random;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class KaptchaTextCreator
/*    */   extends DefaultTextCreator
/*    */ {
/* 19 */   private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
/*    */ 
/*    */ 
/*    */   
/*    */   public String getText() {
/* 24 */     Integer result = Integer.valueOf(0);
/* 25 */     Random random = new Random();
/* 26 */     int x = random.nextInt(10);
/* 27 */     int y = random.nextInt(10);
/* 28 */     StringBuilder suChinese = new StringBuilder();
/* 29 */     int randomoperands = (int)Math.round(Math.random() * 2.0D);
/* 30 */     if (randomoperands == 0) {
/*    */       
/* 32 */       result = Integer.valueOf(x * y);
/* 33 */       suChinese.append(CNUMBERS[x]);
/* 34 */       suChinese.append("*");
/* 35 */       suChinese.append(CNUMBERS[y]);
/*    */     }
/* 37 */     else if (randomoperands == 1) {
/*    */       
/* 39 */       if (x != 0 && y % x == 0)
/*    */       {
/* 41 */         result = Integer.valueOf(y / x);
/* 42 */         suChinese.append(CNUMBERS[y]);
/* 43 */         suChinese.append("/");
/* 44 */         suChinese.append(CNUMBERS[x]);
/*    */       }
/*    */       else
/*    */       {
/* 48 */         result = Integer.valueOf(x + y);
/* 49 */         suChinese.append(CNUMBERS[x]);
/* 50 */         suChinese.append("+");
/* 51 */         suChinese.append(CNUMBERS[y]);
/*    */       }
/*    */     
/* 54 */     } else if (randomoperands == 2) {
/*    */       
/* 56 */       if (x >= y)
/*    */       {
/* 58 */         result = Integer.valueOf(x - y);
/* 59 */         suChinese.append(CNUMBERS[x]);
/* 60 */         suChinese.append("-");
/* 61 */         suChinese.append(CNUMBERS[y]);
/*    */       }
/*    */       else
/*    */       {
/* 65 */         result = Integer.valueOf(y - x);
/* 66 */         suChinese.append(CNUMBERS[y]);
/* 67 */         suChinese.append("-");
/* 68 */         suChinese.append(CNUMBERS[x]);
/*    */       }
/*    */     
/*    */     } else {
/*    */       
/* 73 */       result = Integer.valueOf(x + y);
/* 74 */       suChinese.append(CNUMBERS[x]);
/* 75 */       suChinese.append("+");
/* 76 */       suChinese.append(CNUMBERS[y]);
/*    */     } 
/* 78 */     suChinese.append("=?@" + result);
/* 79 */     return suChinese.toString();
/*    */   }
/*    */ }


/* Location:              /Users/rex/Desktop/x-common-auth-1.0.0-SNAPSHOT.jar!/org/yaukie/auth/config/KaptchaTextCreator.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */